class EduController < ApplicationController

  def index
    @advers=Adver.find(:all)
#    @users=User.find(:all)
    @jiaoshis = User.find(:all,:conditions =>["juese = ?","教师"]) 
    @kechengs = Kecheng.find(:all)
    @zuoyes = Zuoye.find(:all)
  end
  
   def login
    unless request.get? 
      @user = User.find(:first, :conditions => [ "login_name = ?", params[:name]])
      if @user.nil?
        session[:tempUser]=params[:name]
        self.redirect_to "/users/new" 
        flash[:notice]="没有该用户"
      elsif @user.password==params[:pass] 
        session[:user] = @user
  #      self.redirect_to "/file/new"
        flash[:notice] = "登陆成功!" 
        self.redirect_to "/" + determin_layout
      else 
        render :text=> "密码错误!" 
      end 
    end 
  end
  
end
